package com.jdls.tanhua.interceptor;

import com.jdls.tanhua.pojo.User;

/**
 * @author 嘉德罗斯
 * @date 2021/10/24
 */
public class UserHolder {

    private static ThreadLocal<User> threadLocal = new ThreadLocal<>();

    public static void set(User user){
        threadLocal.set(user);
    }

    public static User get(){
        return threadLocal.get();
    }

    public static Long getUserId(){
        return threadLocal.get().getId();
    }

    public static String getPhone(){
        return threadLocal.get().getMobile();
    }
}
